package util

import (
	"time"
)

// 毫秒时间差
func MsTimeDiff(before, after time.Time) (res uint64) {
	beforeTime, _ := time.ParseInLocation("2006-01-02 15:04:05.000", before.Format("2006-01-02 15:04:05.000"), time.Local)
	afterTime, _ := time.ParseInLocation("2006-01-02 15:04:05.000", after.Format("2006-01-02 15:04:05.000"), time.Local)
	beforeMs := beforeTime.UnixMilli()
	afterMs := afterTime.UnixMilli()
	if afterMs > beforeMs {
		res = uint64(afterMs - beforeMs)
	}
	return
}
